<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%@taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<head>
	<title>'showAllMessage.jsp'</title>
	<meta http-equiv="Context-Type" content="text/html; charset=UTF-8">
	<script type="text/javascript"
		src="<%=basePath%>/js/jquery-1.6.4.min.js"></script>
	<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}

.STYLE1 {
	font-size: 12px
}

.STYLE3 {
	font-size: 12px;
	font-weight: bold;
}

.STYLE4 {
	color: #03515d;
	font-size: 12px;
}
-->
</style>

	<script>
var  highlightcolor='#c1ebff';
//此处clickcolor只能用win系统颜色代码才能成功,如果用#xxxxxx的代码就不行,还没搞清楚为什么:(
var  clickcolor='#51b2f6';
function  changeto(){
source=event.srcElement;
if  (source.tagName=="TR"||source.tagName=="TABLE")
return;
while(source.tagName!="TD")
source=source.parentElement;
source=source.parentElement;
cs  =  source.children;
//alert(cs.length);
if  (cs[1].style.backgroundColor!=highlightcolor&&source.id!="nc"&&cs[1].style.backgroundColor!=clickcolor)
for(i=0;i<cs.length;i++){
	cs[i].style.backgroundColor=highlightcolor;
}
}

function  changeback(){
if  (event.fromElement.contains(event.toElement)||source.contains(event.toElement)||source.id=="nc")
return
if  (event.toElement!=source&&cs[1].style.backgroundColor!=clickcolor)
//source.style.backgroundColor=originalcolor
for(i=0;i<cs.length;i++){
	cs[i].style.backgroundColor="";
}
}

function  clickto(){
source=event.srcElement;
if  (source.tagName=="TR"||source.tagName=="TABLE")
return;
while(source.tagName!="TD")
source=source.parentElement;
source=source.parentElement;
cs  =  source.children;
//alert(cs.length);
if  (cs[1].style.backgroundColor!=clickcolor&&source.id!="nc")
for(i=0;i<cs.length;i++){
	cs[i].style.backgroundColor=clickcolor;
}
else
for(i=0;i<cs.length;i++){
	cs[i].style.backgroundColor="";
}
}

$(function(){
	$("#page").change(function(){
		var page = $("#page").val();
		window.location.href="messageAction!findAll?page=" + page;
	});
	$("#searchKey").focus(function() {
		$("#searchKey").val("");
	}) ;
});

</script>

</head>

<body>
	<table width="100%" border="0" cellspacing="0" cellpadding="0">
		<tr>
			<td height="30" background="images/admin/tab_05.gif">
				<table width="100%" border="0" cellspacing="0" cellpadding="0">
					<tr>

						<td>
							<table width="100%" border="0" cellspacing="0" cellpadding="0">
								<tr>
									<td width="46%" valign="middle">
										<table width="100%" border="0" cellspacing="0" cellpadding="0">
											<tr>
												<td width="5%">
													<div align="center">
														<img src="images/admin/tb.gif" width="16" height="16" />
													</div>
												</td>
												<td width="90%" class="STYLE1">
													<span class="STYLE3">你当前的位置</span>：[评论中心]
												</td>
												<td width="5%" class="STYLE1">
													<form name="searchForm"
														action="messageAction!findByKeyWords?" method="post">
														<table border="0" width="100%">
															<tr>
																<td>
																	<select name="searchKey" id="searchKey">
																		<option value="publishTime">
																			发布时间
																		</option>
																		<option value="userName">
																			用户名称
																		</option>
																	</select>
																</td>
																<td>
																	<input name="keyword" type="text" value="" />
																</td>
																<td>
																	<input type="submit" value="查询" />
																</td>
															</tr>
														</table>
													</form>
												</td>
											</tr>
										</table>
									</td>
									<td width="54%">
										<table border="0" align="right" cellpadding="0"
											cellspacing="0">
											<tr>
												<td width="60">
													<table width="87%" border="0" cellpadding="0"
														cellspacing="0">
														<tr>
															<td class="STYLE1">
																<div align="center">
																	<input type="checkbox" name="checkbox62"
																		value="checkbox" />
																</div>
															</td>
															<td class="STYLE1">
																<div align="center">
																	全选
																</div>
															</td>
														</tr>
													</table>
												</td>
												<td width="60">
													<table width="90%" border="0" cellpadding="0"
														cellspacing="0">
														<tr>
															<td class="STYLE1">
																<div align="center">
																	<img src="images/admin/22.gif" width="14" height="14" />
																</div>
															</td>
															<td class="STYLE1">
																<div align="center">
																	新增
																</div>
															</td>
														</tr>
													</table>
												</td>
												<td width="60">
													<table width="90%" border="0" cellpadding="0"
														cellspacing="0">
														<tr>
															<td class="STYLE1">
																<div align="center">
																	<img src="images/admin/33.gif" width="14" height="14" />
																</div>
															</td>
															<td class="STYLE1">
																<div align="center">
																	修改
																</div>
															</td>
														</tr>
													</table>
												</td>
												<td width="52">
													<table width="88%" border="0" cellpadding="0"
														cellspacing="0">
														<tr>
															<td class="STYLE1">
																<div align="center">
																	<img src="images/admin/11.gif" width="14" height="14" />
																</div>
															</td>
															<td class="STYLE1">
																<div align="center">
																	删除
																</div>
															</td>
														</tr>
													</table>
												</td>
											</tr>
										</table>
									</td>
								</tr>
							</table>
						</td>
					</tr>
				</table>
			</td>
		</tr>

		<tr>
			<td>
				<table width="100%" border="0" cellspacing="0" cellpadding="0">
					<tr>
						<td width="8" background="images/admin/tab_12.gif">
							&nbsp;
						</td>
						<td>
							<table width="100%" border="0" cellpadding="0" cellspacing="1"
								bgcolor="b5d6e6" onmouseover="changeto()"
								onmouseout="changeback()">
								<tr>
									<td width="3%" height="22" background="images/admin/bg.gif"
										bgcolor="#FFFFFF">
										<div align="center">
											<input type="checkbox" name="checkbox" value="checkbox" />
										</div>
									</td>
									<td width="4%" height="22" background="images/admin/bg.gif"
										bgcolor="#FFFFFF">
										<div align="center">
											<span class="STYLE1">id</span>
										</div>
									</td>
									<td width="14%" height="22" background="images/admin/bg.gif"
										bgcolor="#FFFFFF">
										<div align="center">
											<span class="STYLE1">内容</span>
										</div>
									</td>
									<td width="10%" height="22" background="images/admin/bg.gif"
										bgcolor="#FFFFFF">
										<div align="center">
											<span class="STYLE1">发布时间</span>
										</div>
									</td>
									<td width="10%" height="22" background="images/admin/bg.gif"
										bgcolor="#FFFFFF">
										<div align="center">
											<span class="STYLE1">评论人</span>
										</div>
									</td>
									<td width="14%" height="22" background="images/admin/bg.gif"
										bgcolor="#FFFFFF">
										<div align="center">
											<span class="STYLE1">所属图片名称</span>
										</div>
									</td>
									<td width="29%" height="22" background="images/admin/bg.gif"
										bgcolor="#FFFFFF" class="STYLE1">
										<div align="center">
											基本操作
										</div>
									</td>
								</tr>
								<s:if test="pageBean.list.size == 0">没有此记录！</s:if>
								<c:forEach items="${pageBean.list}" var="message">
									<tr>
										<td height="20" bgcolor="#FFFFFF">
											<div align="center">
												<input type="checkbox" name="checkbox2" value="checkbox" />
											</div>
										</td>
										<td height="20" bgcolor="#FFFFFF">
											<div align="center" class="STYLE1">
												<div align="center">
													${message.id }
												</div>
											</div>
										</td>
										<td height="20" bgcolor="#FFFFFF">
											<div align="center">
												<span class="STYLE1"><c:out value="${message.content}" escapeXml="false"></c:out>
												</span>
											</div>
										</td>
										<td height="20" bgcolor="#FFFFFF">
											<div align="center">
												<span class="STYLE1">${message.publishTime }
												</span>
											</div>
										</td>
										<td height="20" bgcolor="#FFFFFF">
											<div align="center">
												<span class="STYLE1">${message.user.userName}</span>
											</div>
										</td>
										<td height="20" bgcolor="#FFFFFF">
											<div align="center">
												<span class="STYLE1">${message.picture.picName}</span>
											</div>
										</td>
										<td height="20" bgcolor="#FFFFFF">
											<div align="center">
												<span class="STYLE4"> <img src="images/admin/del.gif"
														width="16" height="16" /> <a
													href="messageAction!deleteById?message.id=${message.id }">删除</a>
												</span>
											</div>
										</td>
									</tr>
								</c:forEach>
								<%--
								<s:iterator value="pageBean.list">
									<tr>
										<td height="20" bgcolor="#FFFFFF">
											<div align="center">
												<input type="checkbox" name="checkbox2" value="checkbox" />
											</div>
										</td>
										<td height="20" bgcolor="#FFFFFF">
											<div align="center" class="STYLE1">
												<div align="center">
													<s:property value="id" />
												</div>
											</div>
										</td>
										<td height="20" bgcolor="#FFFFFF">
											<div align="center">
												<span class="STYLE1"><c:out value="${content}" escapeXml="false"></c:out>
												</span>
											</div>
										</td>
										<td height="20" bgcolor="#FFFFFF">
											<div align="center">
												<span class="STYLE1"><s:property value="publishTime" />
												</span>
											</div>
										</td>
										<td height="20" bgcolor="#FFFFFF">
											<div align="center">
												<span class="STYLE1"><s:property value="picture.picName" /> </span>
											</div>
										</td>
										<td height="20" bgcolor="#FFFFFF">
											<div align="center">
												<span class="STYLE1"><s:property value="user.userName" /> </span>
											</div>
										</td>
										<td height="20" bgcolor="#FFFFFF">
											<div align="center">
												<span class="STYLE4"> <img src="images/admin/del.gif"
														width="16" height="16" /> <a
													href="messageAction!deleteById?message.id=<s:property value="id"/>">删除</a>
												</span>
											</div>
										</td>
									</tr>
								</s:iterator>
							--%></table>
						</td>
						<td width="3" background="images/admin/tab_15.gif">
							&nbsp;
						</td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td height="35" background="images/admin/tab_19.gif">
				<table width="100%" border="0" cellspacing="0" cellpadding="0">
					<tr>
						<td width="12" height="35">
							<img src="images/admin/tab_18.gif" width="12" height="35" />
						</td>
						<td>
							<table width="100%" border="0" cellspacing="0" cellpadding="0">
								<tr>
									<td class="STYLE4">
										&nbsp;&nbsp;共有
										<s:property value="pageBean.allRow" />
										条记录，当前第
										<s:property value="pageBean.currentPage" />
										/
										<s:property value="pageBean.totalPage" />
										页
									</td>
									<td>
										<table border="0" align="right" cellpadding="0"
											cellspacing="0">
											<tr>
												<s:if test="%{pageBean.currentPage != pageBean.totalPage}">
													<td width="40">
														<span class="STYLE1"> <a
															href="messageAction!findAll?page=<s:property value="pageBean.totalPage"/>">尾页
														</a> </span>
													</td>
													<td width="45">
														<span class="STYLE1"> <a
															href="messageAction!findAll?page=<s:property value="%{pageBean.currentPage+1}"/>">下一页
														</a> </span>
													</td>
												</s:if>
												<s:if test="%{pageBean.currentPage == 1}"></s:if>
												<s:else>
													<td width="45">
														<span class="STYLE1"> <a
															href="messageAction!findAll?page=<s:property value="%{pageBean.currentPage-1}"/>">上一页
														</a> </span>
													</td>
													<td width="40">
														<span class="STYLE1"> <a
															href="messageAction!findAll?page=1">首页 </a> </span>
													</td>
												</s:else>
												<td width="100">
													<select name="page" id="page">
														<s:iterator value="pageBean.pageNumbers"
															status="pageNumbers">
															<s:iterator
																value="pageBean.pageNumbers[#pageNumbers.index]">
																<option value="<s:property/>">
																	<s:property />
																</option>
															</s:iterator>
														</s:iterator>
													</select>
												</td>
											</tr>
										</table>
									</td>
								</tr>
							</table>
						</td>
						<td width="12">
							<img src="images/admin/tab_20.gif" width="16" height="35" />
						</td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
</body>
</html>
